/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * jdAsignarFuncionUsuario.java
 *
 * Created on 17-ago-2010, 9:56:24
 */

package GestionRoles;

import administracion.delegate.GestionSeguridadDelegate;
import administracion.helper.MiTablePrint;
import administracion.helper.Utiles_MensajesDialogo;
import administracion.helper.Utiles_Tabla;
import com.jidesoft.hints.ListDataIntelliHints;
import java.awt.event.KeyEvent;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JTable;
import org.jdesktop.beansbinding.AutoBinding;
import org.jdesktop.beansbinding.BindingGroup;
import org.jdesktop.beansbinding.ELProperty;
import org.jdesktop.swingbinding.JTableBinding;
import org.jdesktop.swingbinding.SwingBindings;
import seguridad.administracion.ejb30.TO.DetalleUsuarioRolTO;
import seguridad.administracion.ejb30.TO.RolTO;
import seguridad.administracion.ejb30.TO.UsuarioTO;
import seguridad.administracion.ejb30.entity.DetalleRolFuncion;
import seguridad.administracion.ejb30.entity.Detalleusuariorol;
import seguridad.administracion.ejb30.entity.DetalleusuariorolPK;

/**
 *
 * @author Diana
 */
public class jdAsignarFuncionUsuario extends javax.swing.JDialog {
     private BindingGroup bindingGroup;
     private JTableBinding jTableBinding;
     private ListDataIntelliHints intelliHintsTrabajador;
     private List<UsuarioTO> trabajadores;
     private List<DetalleUsuarioRolTO> usuariosrol;
     private List<DetalleUsuarioRolTO> usuariosrolverificar;
     private List<DetalleUsuarioRolTO> usuariosroleliminar;
     private List<DetalleUsuarioRolTO> usuariosrolagregar;
    /** Creates new form jdAsignarFuncionUsuario */
    public jdAsignarFuncionUsuario(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        try {
            this.trabajadores = GestionSeguridadDelegate.getInstance().getListaUsuarios();
            this.cargaHintsIndependientes();
            this.usuariosrolagregar=new  ArrayList<DetalleUsuarioRolTO>();
            this.usuariosroleliminar=new  ArrayList<DetalleUsuarioRolTO>();

        } catch (Exception ex) {
            Logger.getLogger(jdAsignarFuncionUsuario.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
     private void cargaHintsIndependientes() throws Exception {
         this.intelliHintsTrabajador = new ListDataIntelliHints(this.jtfTrabajador,trabajadores);
    }
     public void agregaDetalle(DetalleUsuarioRolTO detalle) throws Exception {
    try {

      if (verificaNoExisteSuministro(detalle)) {
        this.usuariosrol.add(detalle);
        this.usuariosrolagregar.add(detalle);

        actualizaTablaDetalle();
        jbAceptar.setEnabled(true);
      } else {
         Utiles_MensajesDialogo.mensajeAlerta("EL ROL  " + detalle.getDescripcion() +"YA FUE SELECCIONADO");
      }
    } catch (Exception e) {
      throw e;
    }
  }
   private boolean verificaNoExisteSuministro(DetalleUsuarioRolTO detalle) {
    boolean retorno = true;
    for (DetalleUsuarioRolTO det : this.usuariosrol) {
      if (det.getDescripcion().equalsIgnoreCase(detalle.getDescripcion())) {
        retorno = false;
        break;
      }
    }
    return retorno;
  }
    public void actualizaTablaDetalle() {
        this.bindingGroup = new BindingGroup();
        this.jTableBinding = SwingBindings.createJTableBinding(AutoBinding.UpdateStrategy.READ, this.usuariosrol, this.jtFunciones);

        JTableBinding.ColumnBinding columnBinding0 = this.jTableBinding.addColumnBinding(ELProperty.create("${descripcion}"));
        columnBinding0.setColumnName("DESCRIPCION DE ROLES");
        columnBinding0.setColumnClass(String.class);
        columnBinding0.setEditable(false);


        this.bindingGroup.addBinding(this.jTableBinding);
        this.bindingGroup.bind();

        int[] porcentajes= {100};
        try {
            Utiles_Tabla.definirAnchoColumnasJTable(this.jtFunciones, porcentajes);
        } catch (Exception ex) {
            Logger.getLogger(jdAdministrarFuncion.class.getName()).log(Level.SEVERE, null, ex);
        }
  }
    public void cargarTablaDetalle() {
        try {
         usuariosrol = GestionSeguridadDelegate.getInstance().obtenerDetalleUsuarioRol(this.jtfDni.getText());
         usuariosrolverificar=GestionSeguridadDelegate.getInstance().obtenerDetalleUsuarioRol(this.jtfDni.getText());
        } catch (Exception ex) {
            Logger.getLogger(jdAsignarFuncionUsuario.class.getName()).log(Level.SEVERE, null, ex);
        }
        if(usuariosrol.isEmpty()){
             Utiles_MensajesDialogo.mensajeAlerta("No se han encontrado roles asignados al usuario");
        }
        this.bindingGroup = new BindingGroup();
        this.jTableBinding = SwingBindings.createJTableBinding(AutoBinding.UpdateStrategy.READ, this.usuariosrol, this.jtFunciones);

        JTableBinding.ColumnBinding columnBinding0 = this.jTableBinding.addColumnBinding(ELProperty.create("${descripcion}"));
        columnBinding0.setColumnName("DESCRIPCION DE ROLES");
        columnBinding0.setColumnClass(String.class);
        columnBinding0.setEditable(false);


        this.bindingGroup.addBinding(this.jTableBinding);
        this.bindingGroup.bind();

        int[] porcentajes= {100};
        try {
            Utiles_Tabla.definirAnchoColumnasJTable(this.jtFunciones, porcentajes);
        } catch (Exception ex) {
            Logger.getLogger(jdAdministrarFuncion.class.getName()).log(Level.SEVERE, null, ex);
        }
  }
   
    private UsuarioTO getTrabajadorcodigo(String dni){
         UsuarioTO retorno = null;
        for (UsuarioTO user : this.trabajadores) {
          if (user.getDni().equalsIgnoreCase(dni)) {
            retorno = user;
            break;
          }
        }
        return retorno;
    }
    private void buscarTrabajador()
      {
        UsuarioTO pro;
        if (this.jtfDni.getText().trim().length() < 1) {
          try { pro = (UsuarioTO)this.intelliHintsTrabajador.getSelectedHint();
          } catch (NullPointerException ex) {
            pro = null;
          }
        } else {
          pro = this.getTrabajadorcodigo(this.jtfDni.getText().trim());
        }
        if (pro == null) {
          Utiles_MensajesDialogo.mensajeError("El trabajador no existe!");
          this.jtfDni.setText("");
          pro = null;
        } else {
          this.jtfTrabajador.setText(pro.getNombre()+ " - " + pro.getDni());
          this.jtfDni.setText(pro.getDni());
          this.jbtAgregar.requestFocus();
          this.cargarTablaDetalle();

            try {
            } catch (Exception ex) {
                Logger.getLogger(jdAsignarFuncionUsuario.class.getName()).log(Level.SEVERE, null, ex);
            }

        }

    }
     private void eliminarFila() {
        String nom = this.jtFunciones.getValueAt(this.jtFunciones.getSelectedRow(), 0).toString().trim();
        for (DetalleUsuarioRolTO det : this.usuariosrol) {
          if (det.getDescripcion().trim().compareTo(nom.trim())==0) {
            this.usuariosrol.remove(det);
            this.usuariosroleliminar.add(det);
            jbAceptar.setEnabled(true);
            System.out.println("enbtro2222");
            break;
          }
        }
        actualizaTablaDetalle();
      }
     public boolean verificar(int idrol){
         boolean estado=true;
         for(DetalleUsuarioRolTO deta: this.usuariosrolverificar){
             if(deta.getId_rol()==idrol){
                estado=false;
             }
         }
         return estado;

     }
     public boolean verificarEliminar(int idrol){
         boolean estado=true;
         for(DetalleUsuarioRolTO deta: this.usuariosrol){
             if(deta.getId_rol()==idrol){
                estado=false;
             }
         }
         return estado;

     }
     public Boolean registrarRoles(){
        Boolean estado=false;
        UsuarioTO usu= this.getTrabajadorcodigo(this.jtfDni.getText().toString());
        List<Detalleusuariorol> funcirolesa= new ArrayList<Detalleusuariorol>();
         List<Detalleusuariorol> funcirolese= new ArrayList<Detalleusuariorol>();


         for(DetalleUsuarioRolTO deta: this.usuariosrolagregar){
           if(verificar(deta.getId_rol())){
           DetalleusuariorolPK fun_rolPK= new DetalleusuariorolPK (deta.getId_rol(),usu.getDni());
           Detalleusuariorol fun_rol= new Detalleusuariorol();
           fun_rol.setDetalleusuariorolPK(fun_rolPK);
           fun_rol.setFechaOperacion(deta.getFecha());
           funcirolesa.add(fun_rol);
           }
        }
        for(DetalleUsuarioRolTO deta: this.usuariosroleliminar){
            if(verificarEliminar(deta.getId_rol())){
               DetalleusuariorolPK fun_rolPK= new DetalleusuariorolPK (deta.getId_rol(),usu.getDni());
               Detalleusuariorol fun_rol= new Detalleusuariorol();
               fun_rol.setDetalleusuariorolPK(fun_rolPK);
               fun_rol.setFechaOperacion(deta.getFecha());
               funcirolese.add(fun_rol);
            }
               

        }
        try {
           estado= GestionSeguridadDelegate.getInstance().insertarusuarioRol(funcirolesa,funcirolese );
        } catch (Exception ex) {
            Logger.getLogger(jdRegistrarRoles.class.getName()).log(Level.SEVERE, null, ex);
        }
        return estado;
    }


    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jtFunciones = new javax.swing.JTable();
        jbAceptar = new javax.swing.JButton();
        jbCancelar = new javax.swing.JButton();
        jtfDni = new javax.swing.JTextField();
        jtfTrabajador = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jbtAgregar = new javax.swing.JButton();
        jbtEliminar = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setMinimumSize(new java.awt.Dimension(300, 355));
        setName("Form"); // NOI18N

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(gestionseguridadadministrativacliente.GestionSeguridadAdministrativaclienteApp.class).getContext().getResourceMap(jdAsignarFuncionUsuario.class);
        jLabel1.setFont(resourceMap.getFont("jLabel1.font")); // NOI18N
        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        jScrollPane2.setName("jScrollPane2"); // NOI18N

        jtFunciones.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "DESCRIPCION DE ROLES"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }
        });
        jtFunciones.setName("jtFunciones"); // NOI18N
        jScrollPane2.setViewportView(jtFunciones);

        jbAceptar.setFont(resourceMap.getFont("jbAceptar.font")); // NOI18N
        jbAceptar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/iconoscomb/16x16ozygen/actions/apply.png"))); // NOI18N
        jbAceptar.setMnemonic('A');
        jbAceptar.setText(resourceMap.getString("jbAceptar.text")); // NOI18N
        jbAceptar.setEnabled(false);
        jbAceptar.setName("jbAceptar"); // NOI18N
        jbAceptar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbAceptarActionPerformed(evt);
            }
        });
        jbAceptar.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jbAceptarKeyPressed(evt);
            }
        });

        jbCancelar.setFont(resourceMap.getFont("jbCancelar.font")); // NOI18N
        jbCancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/iconoscomb/16x16ozygen/actions/button_cancel.png"))); // NOI18N
        jbCancelar.setMnemonic('C');
        jbCancelar.setText(resourceMap.getString("jbCancelar.text")); // NOI18N
        jbCancelar.setName("jbCancelar"); // NOI18N
        jbCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbCancelarActionPerformed(evt);
            }
        });

        jtfDni.setName("jtfDni"); // NOI18N
        jtfDni.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtfDniActionPerformed(evt);
            }
        });

        jtfTrabajador.setName("jtfTrabajador"); // NOI18N
        jtfTrabajador.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtfTrabajadorActionPerformed(evt);
            }
        });
        jtfTrabajador.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jtfTrabajadorKeyPressed(evt);
            }
        });

        jLabel2.setFont(resourceMap.getFont("jLabel2.font")); // NOI18N
        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        jbtAgregar.setFont(resourceMap.getFont("jbtAgregar.font")); // NOI18N
        jbtAgregar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/iconoscomb/16x16ozygen/actions/list_add.png"))); // NOI18N
        jbtAgregar.setMnemonic('A');
        jbtAgregar.setText(resourceMap.getString("jbtAgregar.text")); // NOI18N
        jbtAgregar.setName("jbtAgregar"); // NOI18N
        jbtAgregar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtAgregarActionPerformed(evt);
            }
        });
        jbtAgregar.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jbtAgregarKeyPressed(evt);
            }
        });

        jbtEliminar.setFont(resourceMap.getFont("jbtEliminar.font")); // NOI18N
        jbtEliminar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/iconoscomb/16x16ozygen/actions/list_remove.png"))); // NOI18N
        jbtEliminar.setMnemonic('E');
        jbtEliminar.setText(resourceMap.getString("jbtEliminar.text")); // NOI18N
        jbtEliminar.setName("jbtEliminar"); // NOI18N
        jbtEliminar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtEliminarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 537, Short.MAX_VALUE)
                        .addGap(10, 10, 10)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(jbtEliminar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jbtAgregar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jtfDni, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel2))
                        .addGap(23, 23, 23)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel1)
                            .addComponent(jtfTrabajador, javax.swing.GroupLayout.PREFERRED_SIZE, 330, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(jbAceptar)
                        .addGap(13, 13, 13)
                        .addComponent(jbCancelar)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap(73, Short.MAX_VALUE)
                        .addComponent(jbtAgregar)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jbtEliminar, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(216, 216, 216))
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel2)
                            .addComponent(jLabel1))
                        .addGap(4, 4, 4)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(2, 2, 2)
                                .addComponent(jtfDni, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jtfTrabajador, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 279, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(3, 3, 3)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jbAceptar)
                    .addComponent(jbCancelar)))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jbAceptarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbAceptarActionPerformed
       if (Utiles_MensajesDialogo.mensajeConfirmacion("Esta seguro de asignar el rol al usuario?")){
            if(registrarRoles()){
                Utiles_MensajesDialogo.mensajeExito();
            }
        }

        this.jtfDni.setText("");
        this.jtfTrabajador.setText("");
        this.usuariosrol.clear();
        this.actualizaTablaDetalle();
        this.usuariosrolagregar=new  ArrayList<DetalleUsuarioRolTO>();
        this.usuariosroleliminar=new  ArrayList<DetalleUsuarioRolTO>();
        this.usuariosrol=new  ArrayList<DetalleUsuarioRolTO>();
        this.usuariosrolverificar=new  ArrayList<DetalleUsuarioRolTO>();
        this.usuariosrolagregar.clear();
        this.usuariosroleliminar.clear();
        this.usuariosrol.clear();
        this.usuariosrolverificar.clear();
    }//GEN-LAST:event_jbAceptarActionPerformed

    private void jbCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbCancelarActionPerformed
        this.usuariosrolagregar=new  ArrayList<DetalleUsuarioRolTO>();
        this.usuariosroleliminar=new  ArrayList<DetalleUsuarioRolTO>();
        this.usuariosrol=new  ArrayList<DetalleUsuarioRolTO>();
        this.usuariosrolverificar=new  ArrayList<DetalleUsuarioRolTO>();
        this.dispose();
}//GEN-LAST:event_jbCancelarActionPerformed

    private void jtfDniActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtfDniActionPerformed
        if (this.jtfDni.getText().trim().length() < 1)
            this.jtfDni.requestFocus();
        else
            this.buscarTrabajador();
}//GEN-LAST:event_jtfDniActionPerformed

    private void jtfTrabajadorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtfTrabajadorActionPerformed

        this.buscarTrabajador();
}//GEN-LAST:event_jtfTrabajadorActionPerformed

    private void jtfTrabajadorKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jtfTrabajadorKeyPressed
        if (this.jtfDni.getText().trim().length() > 0)
            this.jtfDni.setText("");
}//GEN-LAST:event_jtfTrabajadorKeyPressed

    private void jbtAgregarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtAgregarActionPerformed
        jdAsignarRoles jdAgregaDetalle=new jdAsignarRoles(null,true, this);
        jdAgregaDetalle.setLocationRelativeTo(null);
        jdAgregaDetalle.setVisible(true);
}//GEN-LAST:event_jbtAgregarActionPerformed

    private void jbtAgregarKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jbtAgregarKeyPressed
       
    }//GEN-LAST:event_jbtAgregarKeyPressed

    private void jbAceptarKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jbAceptarKeyPressed
          if (evt.getKeyCode() == KeyEvent.VK_ENTER ){
          this.jbAceptar.doClick();
      }
    }//GEN-LAST:event_jbAceptarKeyPressed

    private void jbtEliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtEliminarActionPerformed
        try {
            if (this.jtFunciones.getSelectedRow() < 0) {
                Utiles_MensajesDialogo.mensajeError("Debe elegir un detalle");
                return;
            }
            if (Utiles_MensajesDialogo.mensajeConfirmacion("Esta seguro de eliminar el detalle?"))
                eliminarFila();

        } catch (Exception e) {
            e.printStackTrace();
        }
}//GEN-LAST:event_jbtEliminarActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                jdAsignarFuncionUsuario dialog = new jdAsignarFuncionUsuario(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JScrollPane jScrollPane2;
    public javax.swing.JButton jbAceptar;
    private javax.swing.JButton jbCancelar;
    private javax.swing.JButton jbtAgregar;
    private javax.swing.JButton jbtEliminar;
    public javax.swing.JTable jtFunciones;
    private javax.swing.JTextField jtfDni;
    private javax.swing.JTextField jtfTrabajador;
    // End of variables declaration//GEN-END:variables

}
